package util;

import java.util.ArrayList;
import java.util.List;

import domain.Agent;
import domain.SedResponse;
import domain.Task;

public class Stat {
	
	private SedResponse resp;
	
	public Stat(SedResponse r){
			resp = r;
	}

	public Integer getPoint(){
		return resp.money;
	}
	
	public List<Task> getReadyTasks(){
		List<Task> temp = new ArrayList<Task>();
		for(Task t : resp.tasks){
			if(t.isReady()) temp.add(t);
		}
		return temp;
	}
	
	public List<Task> getFreeTasks(){
		List<Task> temp = new ArrayList<Task>();
		for(Task t : resp.tasks){
			if(t.isFree()) temp.add(t);
		}
		return temp;
	}
	
	public Integer earnedLast100roundPoint(){
		return resp.money; 
	}
	
	public Integer bestAgent(){
		int result = 0;
		for(Agent a : resp.agents){
			if(a.earnedMoney > result )
				result = a.earnedMoney;
		}
		return result;
	}
	
	public Integer worstAgent(){
		int result = Integer.MAX_VALUE;
		for(Agent a : resp.agents){
			if(a.earnedMoney < result )
				result = a.earnedMoney;
		}
		return result;
	}
	
}
